package com.anjho.pojo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "person_type")
public class PersonType implements Serializable {

	private static final long serialVersionUID = 1568036970314377557L;

	@Id
	@Column(name="ptcode")
	@OneToMany(mappedBy="person_type")
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	private int ptcode;
	
	@Column(name="description", nullable=false, length=50)
	private String description;

	public PersonType() {
		super();
	}
	
	public PersonType(int ptcode, String description){
		this.ptcode = ptcode;
		this.description = description;
	}
	
	public int getPtcode() {
		return this.ptcode;
	}

	public void setPtcode(int ptcode) {
		this.ptcode = ptcode;
	}   
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ptcode;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonType other = (PersonType) obj;
		if (ptcode != other.ptcode)
			return false;
		return true;
	}
   
}
